<script type="text/javascript">
onload=self.blur();
</script>
<?php
include_once('ClsSebent/config.php');
$tqry="Select max(trans_id) from cart_saved";
$tr=mysql_query($tqry);
$row=mysql_fetch_array($tr);
$trans_id=$row["trans_id"];
$trans_id=$trans_id+1;
//echo 'Trans ID: '.$trans_id;
$dt=date('m/d/Y');
$q="select * from cart_temp where site_id=".$_SESSION['SITE_ID']." and cur_dt='$dt'";
//echo $q;
$r=mysql_query($q);
while($res=mysql_fetch_array($r))
{
$id=$res["id"];
$sid=$res["site_id"];
$sprod_code=$res["sprod_code"];
$pname=$res["name"];
$qty=$res["qty"];
$pr=$res["unit_pr"];
$c_dt=$res["cur_dt"];
$Tpric=$res["Tprice"];
$dct=$res["discount"];
$Sum=$res["Total"];

$inqry="INSERT INTO `cart_saved` ( `site_id` , `trans_dt` , `trans_id` , `item_code` , `item_name` , `qty` , `pc_price` , `t_price` , `dscnt` , `f_price` )VALUES ($sid, '$dt', $trans_id, $sprod_code, '$pname', $qty, $pr, $Tpric, $dct, $Sum)";
//echo $inqry;
mysql_query($inqry);
}
?>
<script type="text/javascript">
alert("Cart Saved. Your Cart ID is: <?php echo $trans_id;?>");
window.close('cart_save.php');
</script>